package wxwoa

import (
	"github.com/kataras/iris/v12"
	"github.com/kataras/iris/v12/mvc"
)

type WxShareController struct {
	// Optionally: context is auto-binded by Iris on each request,
	// remember that on each incoming request iris creates a new UserController each time,
	// so all fields are request-scoped by-default, only dependency injection is able to set
	// custom fields like the Service which is the same for all requests (static binding).
	Ctx iris.Context
}

func (this *WxShareController) GetShare(ctx iris.Context) mvc.Result {

	// 测试公众号，js sdk 安全域名不非要带 http 前缀

	url := WX_SITE + "/wx/share"
	wxconf := WxJsapiTicket{}.Signature(ctx, url)
	this.Ctx.ViewData("wxconf", wxconf)

	return mvc.View{
		Name: "wxapi/wx.share.html",
		Data: iris.Map{
			"Title":   "分享接口示例",
			"SiteUrl": WX_SITE,
		},
	}
}
